import 'package:flutter/material.dart';
import './data.dart';
import './item_widget.dart';

class Info extends StatelessWidget {
  final bool showTitle;
  final List<InfoItem> dataList;

  const Info({Key key, this.showTitle = false, this.dataList = infoData}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          if(showTitle)
            Container(
              padding: EdgeInsets.only(left: 10.0, top: 10.0),
              alignment: Alignment.centerLeft,
              child: Text(
                '最新咨询',
                style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500)
              ),
            ),
          Column(
            children: dataList.map((item) => ItemWidget(data: item)).toList(),
          )
        ]
      ),
    );
  }
}